enum ActiionType {
  /** 跑 */ 
  Run = 'run',
  /** 吃 */ 
  Eat = 'eat'
}

ActiionType.Run


type Action = 'eat' | 'run'

const a:Action = 'eat'


interface ActionInterface {
  name: string,
  age: number,
  sex?: number
}

const b:ActionInterface = {
  name: 'lu-lu',
  age: 12,
  sex: 1
}
const axios = {
  get(){
    return {
     then(cb) {
      cb({
        name: 'cb',
        age: 123
      })
     }
    }
  }
}

axios.get().then(res=>{
  console.log(res)
})

interface A {
  name: string
}

interface B{
  age: number
}
// 联合类型
function test (data: A | B){
  console.log(data)
}
// 交叉类型
function test1 (data: A & B){
  console.log(data)
}

test({age:123})

test1({age: 123,name:'yyds'})


function toArrary(x: number):Array<number> {
  return [x]
}

console.log(toArrary(12))

interface A_fanxing<T>{
  a: T
}

const aFanxing:A_fanxing<number> = {a: 123}


interface RouterName {
  name: string
}

const router:RouterName = {
  name: 'sd'
}